import type { ProColumns } from '@ant-design/pro-table';

// 定义请求返回数据类型
export type ColumnsItem = {
  seqNo: number;
  txNo: string;
  disctTxType: string;
  totalDisctAmt: number;
  status: string;
  payeeOrdNo: string;
  type: string;
  disctNo: string;
  disctAmt: number;
  shareTm: string;
}

// 定义表头
let columnsData: ProColumns<ColumnsItem>[] = [
  {
    title: '发放商户号',
    hideInTable: true,
    dataIndex: 'metNo',
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '受益人',
    dataIndex: 'serialNumber',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '交易结果',
    dataIndex: 'result',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      0: { text: '交易中', status: 'Processing' },
      1: { text: '成功', status: 'Success' },
      2: { text: '失败', status: 'Failure ' },
    },
  },
  {
    title: '折扣发放日期',
    dataIndex: 'created_at',
    hideInTable: true,
    valueType: 'dateRange',
    search: {
      transform: (value) => {
        return {
          startTime: value[0],
          endTime: value[1],
        };
      },
    },
  },
  {
    title: '关联商品订单号',
    hideInTable: true,
    dataIndex: 'prodOrdNo',
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '交易流水号',
    hideInTable: true,
    dataIndex: 'txNo',
    fieldProps: {
      maxLength: 20
    },
  },

  // 上方查询，下方表头
  {
    title: '关联商品订单号',
    width: 200,
    fixed: 'left',
    hideInSearch: true,
    dataIndex: 'prodOrdNo',
  },
  {
    title: '折扣发放总额',
    width: 120,
    hideInSearch: true,
    dataIndex: 'totalDisctAmt',
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy1',
  },
  {
    title: '获赠者类别',
    width: 100,
    hideInSearch: true,
    dataIndex: 'type',
    valueType: 'select',
    valueEnum: {
      0: { text: '平台' },
      1: { text: '会员' },
      2: { text: '推荐人' },
    },
  },
  {
    title: '获赠金额',
    width: 120,
    hideInSearch: true,
    dataIndex: 'disctAmt',
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy2',
  },
  {
    title: '交易流水号',
    width: 200,
    hideInSearch: true,
    dataIndex: 'txNo',
  },
  {
    title: '折扣发放时间',
    width: 160,
    hideInSearch: true,
    dataIndex: 'shareTm',
  },
  {
    title: '折扣编码',
    width: 160,
    hideInSearch: true,
    dataIndex: 'disctNo',
  },
  {
    title: '交易结果',
    hideInSearch: true,
    dataIndex: 'status',
    width: 100,
    valueType: 'select',
    valueEnum: {
      0: { text: '在途', status: 'Processing' },
      1: { text: '发放', status: 'Success' },
      2: { text: '失败', status: 'Failure ' },
    },
  },
  {
    title: '备注',
    width: 160,
    hideInSearch: true,
    dataIndex: 'remark',
  },
  {
    title: '操作',
    width: 80,
    fixed: 'right',
    align: 'center',
    valueType: 'option',
  }
]
export default columnsData;
